#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/header.h"
#include "ns3/simulator.h"
#include "ac_header.h"
#include <vector>

NS_LOG_COMPONENT_DEFINE ("AcHeader");

namespace ns3 {


NS_OBJECT_ENSURE_REGISTERED (AcHeader);
AcHeader::AcHeader()
{
NS_LOG_FUNCTION (this);
}


AcHeader::AcHeader (uint8_t cas,uint16_t n)
{
  NS_LOG_FUNCTION (this);
    pckt_type=cas;
    node=n;
}

uint8_t  AcHeader::GetData(uint16_t &n)
{
    n=node;
return pckt_type;
}

TypeId
AcHeader::GetTypeId (void)
{
  static TypeId tid = TypeId ("ns3::AcHeader")
    .SetParent<Header> ()
    .AddConstructor<AcHeader> ()
  ;
  return tid;   
}
TypeId
AcHeader::GetInstanceTypeId (void) const
{
  return GetTypeId ();
}
void
AcHeader::Print (std::ostream &os) const
{
  NS_LOG_FUNCTION (this << &os);
}
uint32_t
AcHeader::GetSerializedSize (void) const
{
  NS_LOG_FUNCTION (this);
  
  return 1+2;
}

void
AcHeader::Serialize (Buffer::Iterator start) const
{
  NS_LOG_FUNCTION (this << &start);
Buffer::Iterator j = start;
     
//Serialize the packet type
    j.WriteU8 (pckt_type);
    j.WriteU16(node);
    
}
uint32_t
AcHeader::Deserialize (Buffer::Iterator start)
{
  NS_LOG_FUNCTION (this << &start);
  Buffer::Iterator j = start;
    

    /*Retrieve the packet type*/ 
    pckt_type=j.ReadU8();
    
    node=j.ReadU16();
    
  return GetSerializedSize ();
}

} // namespace ns3
